package club.ruanx.movie.service.impl;



import club.ruanx.bean.PageBean;
import club.ruanx.core.service.base.BaseServiceImpl;
import club.ruanx.movie.entity.NewsComment;
import club.ruanx.movie.repository.NewsCommentRepository;
import club.ruanx.movie.service.NewsCommentService;
import org.springframework.data.domain.Page;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * @author 阮胜
 * @date 2018/11/11 19:50
 */
@Service
@Transactional(rollbackFor = Exception.class)
public class NewsCommentServiceImpl extends BaseServiceImpl<NewsComment, String, NewsCommentRepository> implements NewsCommentService {

    @Override
    public Page<NewsComment> findAllByNewsId(String newsId, PageBean pageBean) {
        return repository.findAllByNewsIdOrderByCreateTimeDesc(newsId, pageBean.toPageable());
    }
}
